"""
Copyright (c) 2022 Guangdong University of Technology
PhotLab is licensed under [Open Source License].
You can use this software according to the terms and conditions of the [Open Source License].
You may obtain a copy of [Open Source License] at: [https://open.source.license/]

THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.

See the [Open Source License] for more details.

Author: Meng Xiang, Junjiang Xiang
Created: 2023/8/19
Supported by: National Key Research and Development Program of China
"""

import numpy as np


def up_sample(input, up_sampling_factor):
    """上采样
    Args:
        input: 输入bit信号, numpy类型
        up_sampling_factor：上采样倍数

    Returns:
        upsampled_signal: 输出信号
    """
    input_0=input[0]
    input_1=input[1]

    upsampled_signal_0 = np.zeros(len(input_0) * up_sampling_factor, dtype=complex)
    upsampled_signal_0[::up_sampling_factor] = input_0

    upsampled_signal_1 = np.zeros(len(input_1) * up_sampling_factor, dtype=complex)
    upsampled_signal_1[::up_sampling_factor] = input_1

    upsampled_signal = [upsampled_signal_0, upsampled_signal_1]

    return upsampled_signal